<template>
  <div>
    <!-- 导航栏 -->
    <van-nav-bar title="搜索中心" left-arrow @click-left="$router.back()" left-text="返回" />
    <van-search
      v-model="value"
      @search="
        $router.push({ path: '/searchResult', query: { keyword: value } })
      "
      @input="onInput"
      show-action
      placeholder="请输入搜索关键词"
    >
      <template #action>
        <div
          @click="
            $router.push({ path: '/searchResult', query: { keyword: value } })
          "
        >
          搜索
        </div>
      </template>
    </van-search>
    <van-cell-group
      v-for="(item, index) in changeGo"
      :key="index"
      @click="
        $router.push({
          path: '/searchResult',
          query: { keyword: changeList[index] }
        })
      "
    >
      <van-cell icon="search">
        <template #title>
          <div v-html="item"></div>
        </template>
      </van-cell>
    </van-cell-group>
    <van-cell value="历史记录" />
    <van-cell-group>
      <van-cell v-for="(item, index) in allHistory" :key="index" :title="item">
        <template #right-icon>
          <van-icon name="close" class="search-icon" />
        </template>
      </van-cell>
      <van-cell>
        <div class="clear" @click="onHistory">清除历史记录</div>
      </van-cell>
    </van-cell-group>
  </div>
</template>

<script>
import { } from './home.js'
export default {

}
</script>

<style lang="less">
.clear {
  text-align: center;
}
</style>
